package com.wmh.baseservice.robot.enums;

import com.wmh.baseservice.common.validation.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author 谢骏
 * @date 2023/3/16 10:56
 * 任务状态枚举
 **/
@Getter
@AllArgsConstructor
public enum TaskStatus implements IntArrayValuable {
    /**
     * 未开始
     */
    NOT_STARTED(0, "未开始"),
    /**
     * 运行中
     */
    RUNNING(1, "运行中"),
    /**
     * 已结束
     */
    STOP(2, "已结束"),
    /**
     * 已失败
     */
    ERROR(3, "已失败");

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TaskStatus::getValue).toArray();

    private final Integer value;

    private final String label;

    @Override
    public int[] array() {
        return ARRAYS;
    }
}
